;Assembler header file for DeviceFS
;written by DefMod (Dec 31 2005) on Sat Dec 31 14:01:37 2005
;Jonathan Coxhead, jonathan@doves.demon.co.uk, 29 June 1995

        [       :LNOT: :DEF: DeviceFS_Hdr
        GBLS    DeviceFS_Hdr

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET oslib/Types.Hdr"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET oslib/OS.Hdr"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

        [       :LNOT: :DEF: Get_OSArgs
        GBLS    Get_OSArgs
        ]
        [       :LNOT: :DEF: OSArgs_Hdr
Get_OSArgs                      SETS    "GET oslib/OSArgs.Hdr"
        |
Get_OSArgs                      SETS    ""
        ]
        $Get_OSArgs

        [       :LNOT: :DEF: Get_Buffer
        GBLS    Get_Buffer
        ]
        [       :LNOT: :DEF: Buffer_Hdr
Get_Buffer                      SETS    "GET oslib/Buffer.Hdr"
        |
Get_Buffer                      SETS    ""
        ]
        $Get_Buffer

;Symbols for constants
DeviceFS_DeviceBuffered         *       &1
DeviceFS_DeviceUsesPathVar      *       &2
DeviceFS_RegisterBlockDevice    *       &1
DeviceFS_RegisterFullDuplex     *       &2
DeviceFS_OpenForRx              *       &0
DeviceFS_OpenForTx              *       &1

;Symbols for structure offsets and sizes
                                ^       0
                                #       Bits
DeviceFS_Flags                  *       @

DeviceFS_D                      *       4 ;abstract type
DeviceFS_S                      *       4 ;abstract type
DeviceFS_H                      *       4 ;abstract type
                                ^       0
DeviceFS_Device_name_offset     #       Int
DeviceFS_Device_flags           #       DeviceFS_Flags
DeviceFS_Device_rx_flags        #       Bits
DeviceFS_Device_rx_buffer_size  #       Int
DeviceFS_Device_tx_flags        #       Bits
DeviceFS_Device_tx_buffer_size  #       Int
DeviceFS_Device_reserved        #       Int
DeviceFS_Device                 *       @

                                ^       0
DeviceFS_DeviceList_d           #       DeviceFS_Device
DeviceFS_DeviceList             *       @

                                ^       0
                                #       Bits
DeviceFS_RegisterFlags          *       @

                                ^       0
                                #       Bits
DeviceFS_InitialiseFlags        *       @


;Symbols for SWI's and SWI reason codes
XDeviceFS_Register              *       &62740
DeviceFS_Register               *       &42740
   ;Entry
   ;  R0 = flags (DeviceFS_RegisterFlags)
   ;  R1 -> devices (DeviceFS_DeviceList)
   ;  R2 -> driver (code)
   ;  R3 = handle (Int)
   ;  R4 = workspace (pointer to Void)
   ;  R5 -> validation (String)
   ;  R6 = rx_limit (Int)
   ;  R7 = tx_limit (Int)
   ;Exit
   ;  R0 = d (DeviceFS_D)

XDeviceFS_Deregister            *       &62741
DeviceFS_Deregister             *       &42741
   ;Entry
   ;  R0 = d (DeviceFS_D)

XDeviceFS_RegisterObjects       *       &62742
DeviceFS_RegisterObjects        *       &42742
   ;Entry
   ;  R0 = d (DeviceFS_D)
   ;  R1 -> devices (DeviceFS_DeviceList)

XDeviceFS_DeregisterObjects     *       &62743
DeviceFS_DeregisterObjects      *       &42743
   ;Entry
   ;  R0 = d (DeviceFS_D)
   ;  R1 -> device_name (String)

XDeviceFS_CallDevice            *       &62744
DeviceFS_CallDevice             *       &42744

DeviceFSCallDevice_Initialise   *       &0
   ;Entry
   ;  R0 = &0
   ;  R1 = d (DeviceFS_D)
   ;  R2 = s (DeviceFS_S)
   ;  R3 = flags (DeviceFS_InitialiseFlags)
   ;  R6 -> decoded_special (data)
   ;Exit
   ;  R2 = h (DeviceFS_H)

DeviceFSCallDevice_Terminate    *       &1
   ;Entry
   ;  R0 = &1
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)

DeviceFSCallDevice_TxWakeUp     *       &2
   ;Entry
   ;  R0 = &2
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)
   ;Exit
   ;  R0 = woken_up (Bool)

DeviceFSCallDevice_RxWakeUp     *       &3
   ;Entry
   ;  R0 = &3
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)

DeviceFSCallDevice_RxSleep      *       &4
   ;Entry
   ;  R0 = &4
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)

DeviceFSCallDevice_EnumDir      *       &5
   ;Entry
   ;  R0 = &5
   ;  R1 = d (DeviceFS_D)
   ;  R2 -> file_name (String)

DeviceFSCallDevice_TxCreateBuffer *       &6
   ;Entry
   ;  R0 = &6
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)
   ;  R3 = flags (Buffer_Flags)
   ;  R4 = size (Int)
   ;  R5 = b (Buffer_B)
   ;  R6 = threshold (Int)
   ;Exit
   ;  R3 = flags_out (Buffer_Flags)
   ;  R4 = size_out (Int)
   ;  R5 = b_out (Buffer_B)
   ;  R6 = threshold_out (Int)

DeviceFSCallDevice_RxCreateBuffer *       &7
   ;Entry
   ;  R0 = &7
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)
   ;  R3 = flags (Buffer_Flags)
   ;  R4 = size (Int)
   ;  R5 = b (Buffer_B)
   ;  R6 = threshold (Int)
   ;Exit
   ;  R3 = flags_out (Buffer_Flags)
   ;  R4 = size_out (Int)
   ;  R5 = b_out (Buffer_B)
   ;  R6 = threshold_out (Int)

DeviceFSCallDevice_Halt         *       &8
   ;Entry
   ;  R0 = &8
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)

DeviceFSCallDevice_Resume       *       &9
   ;Entry
   ;  R0 = &9
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)

DeviceFSCallDevice_EndOfData    *       &A
   ;Entry
   ;  R0 = &A
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)
   ;  R3 = &FFFFFFFF
   ;Exit
   ;  R3 = end_of_data (Bool)

DeviceFSCallDevice_StreamCreated *       &B
   ;Entry
   ;  R0 = &B
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)
   ;  R3 = b (Buffer_B)

DeviceFSCallDevice_IOCtl        *       &E
   ;Entry
   ;  R0 = &E
   ;  R1 = d (DeviceFS_D)
   ;  R2 = h (DeviceFS_H)
   ;  R3 = parameters (pointer to OSArgs_IOCtlParameters)

XDeviceFS_Threshold             *       &62745
DeviceFS_Threshold              *       &42745
   ;Entry
   ;  R1 = s (DeviceFS_S)
   ;  R2 = threshold (Int)

XDeviceFS_ReceivedChar          *       &62746
DeviceFS_ReceivedChar           *       &42746
   ;Entry
   ;  R0 = b (Byte)
   ;  R1 = s (DeviceFS_S)

XDeviceFS_TransmitChar          *       &62747
DeviceFS_TransmitChar           *       &42747
   ;Entry
   ;  R1 = s (DeviceFS_S)
   ;Exit
   ;  R0 = b (Byte)

Service_DeviceFSStarting        *       &70
   ;Entry
   ;  R1 = &70

Service_DeviceFSDying           *       &71
   ;Entry
   ;  R0 = &0
   ;  R1 = &71

Service_DeviceDead              *       &79
   ;Entry
   ;  R0 = &0
   ;  R1 = &79
   ;  R2 = d (DeviceFS_D)
   ;  R3 -> device_name (String)

Service_DeviceFSCloseRequest    *       &81
   ;Entry
   ;  R1 = &81
   ;  R2 = file (OS_F)
   ;Exit
   ;  R1 = unclaimed (Bool)

Service_DeviceFSCloseRequestW   *       &81
   ;Entry
   ;  R1 = &81
   ;  R2 = file (OS_FW)
   ;Exit
   ;  R1 = unclaimed (Bool)

UpCall_StreamCreated            *       &A
   ;Entry
   ;  R0 = &A
   ;  R1 = d (DeviceFS_D)
   ;  R2 = tx_stream (Bool)
   ;  R3 = file (OS_F)
   ;  R4 = s (DeviceFS_S)

UpCall_StreamCreatedW           *       &A
   ;Entry
   ;  R0 = &A
   ;  R1 = d (DeviceFS_D)
   ;  R2 = tx_stream (Bool)
   ;  R3 = file (OS_FW)
   ;  R4 = s (DeviceFS_S)

UpCall_StreamClosed             *       &B
   ;Entry
   ;  R0 = &B
   ;  R1 = d (DeviceFS_D)
   ;  R2 = tx_stream (Bool)
   ;  R3 = file (OS_F)
   ;  R4 = s (DeviceFS_S)

UpCall_StreamClosedW            *       &B
   ;Entry
   ;  R0 = &B
   ;  R1 = d (DeviceFS_D)
   ;  R2 = tx_stream (Bool)
   ;  R3 = file (OS_FW)
   ;  R4 = s (DeviceFS_S)

UpCall_DeviceRxDataPresent      *       &F
   ;Entry
   ;  R0 = &F
   ;  R1 = d (DeviceFS_D)

UpCall_DeviceThresAbove         *       &10
   ;Entry
   ;  R0 = &10
   ;  R1 = d (DeviceFS_D)

UpCall_DeviceThresBelow         *       &11
   ;Entry
   ;  R0 = &11
   ;  R1 = d (DeviceFS_D)

Event_DeviceOverrun             *       &16
   ;Entry
   ;  R0 = &16
   ;  R1 = d (DeviceFS_D)
   ;  R2 = file (OS_F)
   ;  R3 = &0

Event_DeviceOverrunW            *       &16
   ;Entry
   ;  R0 = &16
   ;  R1 = d (DeviceFS_D)
   ;  R2 = file (OS_FW)
   ;  R3 = &0

        ]
        END
